import { REQUEST_STATUS } from '../enum/STATUS_CODE'

export let ApiResponse = function (data, status) {
  // attributes
  this.data = data || []
  this.status = status || REQUEST_STATUS.UNKNOWN
  // methods
  this.getData = function () {
    return this.data
  }
}

ApiResponse.prototype.setStatus = function (status) {
  if (status) {
    this.status = status
  }
}

ApiResponse.prototype.isSuccess = function () {
  return this.status == REQUEST_STATUS.REQUEST_SUCCESS
}
